<template>
  <zw-card title="登录日志" :line="1" :center="false">
    <el-scrollbar height="296px">
      <el-timeline style="max-width: 600px;min-width: 328px;">
        <el-timeline-item v-for="(item, index) in loginLogs" :key="item.id" :timestamp="item.logTime" placement="top"
          :type="['primary', 'success', 'danger', 'warning'][index % 4]">
          {{ `${item.logUser}登录系统` }}
        </el-timeline-item>
      </el-timeline>
    </el-scrollbar>
  </zw-card>
</template>
<script lang="ts" setup>
import ZwCard from '@/components/CardFrame/ZwCard.vue';
import ApiTree from '@/server/api-tree';
import type { LogDTO } from '@/server/log/types';
import { onMounted, ref } from 'vue';
const loginLogs = ref<LogDTO[]>([]);
const getLoginLogs = async () => {
  const { success, data } = await ApiTree.log.getLoginLog(1, 20);
  if (success) {
    loginLogs.value = data;
  }
}
onMounted(() => {
  getLoginLogs();
})
</script>
<style lang="scss" scope></style>
